x86/mm: Fix liveness of pages in grant copy operations
authorAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 24 Nov 2011 17:05:25 +0000 (17:05 +0000)
committerAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 24 Nov 2011 17:05:25 +0000 (17:05 +0000)
commit3c42e2fcfa0d4822b5e109953bb2d5bd96ff02e1
treef620406e68877b547be5f82dd7a6638fc6184702
parentb61d7d4e30f35c3e07f4323a32e1b1f3e610154b
x86/mm: Fix liveness of pages in grant copy operations

We were immediately putting the p2m entry translation for grant
copy operations. This allowed for an unnecessary race by which the
page could have been swapped out between the p2m lookup and the actual
use. Hold on to the p2m entries until the grant operation finishes.

Also fixes a small bug: for the source page of the copy, get_page
was assuming the page was owned by the source domain. It may be a
shared page, since we don't perform an unsharing p2m lookup.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/common/grant_table.c